home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Vypalování CD
/
Vypalovani-CD-cd1.bin
/
Backup-Burner Add-On SDK 5.0
/
ExampleSource
/
Delphi
/
Unit1.pas
< prev
Wrap
Pascal/Delphi Source File
|
2002-03-23
|
6KB
|
170 lines
// ----------------------------------------------------------------------------
//
// Project:
// Example of using Delphi with Backup-Burner Add-on SDK
// February, 2002
// ⌐Desernet Broadband Media, Inc.
// Produced by: D. Clark
//
// Compiles in Delphi 5 without hints, warnings, or errors.
//
// ----------------------------------------------------------------------------
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, FileCtrl,
Registry, StdCtrls, Menus, Buttons;
type
TForm1 = class(TForm)
Label1: TLabel;
Label3: TLabel;
Label4: TLabel;
ResultsLabel: TLabel;
Memo1: TMemo;
Button2: TButton;
Button3: TButton;
MainMenu1: TMainMenu;
File1: TMenuItem;
Exit1: TMenuItem;
N1: TMenuItem;
BackuptoCD1: TMenuItem;
Label5: TLabel;
OpenDialog1: TOpenDialog;
procedure TwoButtonClick(Sender: TObject);
procedure ThreeButtonClick(Sender: TObject);
procedure ExitClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
ResultCode: Integer;
BBRegName,
BBRegCode,
BBVolume,
BBTitle,
BBColorForm,
BBColorText,
BBFolderPath,
BBFutureUse: String;
implementation
{$R *.DFM}
procedure TForm1.ThreeButtonClick(Sender: TObject);
// Temporarily Disable Burn CD button to avoid double clicks
// Copy desired files to \Bin\FilesToBackup\ folder
// Fill in registration numbers, and
// OPTIONAL- Fill in desired Volume name (to be burned as CD title) or use null '';
// Hide or minimize your program
// Launch MakeBackupCD function in BackupBurner.dll
// When function returns, the CD process is complete.
// Unhide or restore your program
// OPTIONAL- Inspect the result code
// OPTIONAL- delete unneeded files from \Bin\FilesToBackup\
// You are done.
var
H: THandle;
MakeBackupCD: function(BBRegName, BBRegCode, BBVolume, BBTitle, BBColorForm, BBColorText, BBFolderPath, BBFutureUse: PChar): integer; stdcall;
begin
// Temporarily Disable Burn CD button to avoid double clicks
Button3.Enabled := False;
// Copy desired files to \Bin\FilesToBackup\ folder (or use the files selected by the #2 button)
CopyFile(Pchar('\Automenu\AutoRun.exe'), Pchar('Bin\FilesToBackup\AutoRun.exe'),FALSE );
CopyFile(Pchar('\Automenu\AutoRun.inf'), Pchar('Bin\FilesToBackup\AutoRun.inf'),FALSE );
// Fill in registration numbers, and
// OPTIONAL- Fill in desired Volume name (to be burned as CD title) or use null '';
BBRegName := 'DEMOUSER';
BBRegCode := 'ABCD1234';
BBVolume := 'MyBackupCD'; //' What ever you want here, but no spaces allowed
BBTitle := Memo1.Lines[0] + Memo1.Lines[1] ;//This is your program title to display on the recording form.
BBColorForm := 'clSilver';//default is clSilver, don't use hex color
BBColorText := 'clBlack';//default is clBlack, don't use hex color
BBFolderPath:= ExtractFilePath(ParamStr(0)) + 'FilesToBackup\'; // Make this any folder containing your desired files.
BBFutureUse := '';
// Hide or minimize your program
Application.Minimize;
// Launch MakeBackupCD function in BackupBurner.dll
// When function returns, the CD process is complete...
If FileExists(ExtractFilePath(ParamStr(0)) + 'Bin\'+ 'BackupBurner.dll') then
begin
ResultCode := 100;
H := LoadLibrary( Pchar(ExtractFilePath(ParamStr(0)) + 'Bin\'+ 'BackupBurner.dll') );
if H <> NULL then
begin
try
@MakeBackupCD := GetProcAddress(H, 'MakeBackupCD');
if Assigned(MakeBackupCD) then
ResultCode := MakeBackupCD(PChar(BBRegName), PChar(BBRegCode), PChar(BBVolume), PChar(BBTitle), PChar(BBColorForm), PChar(BBColorText), PChar(BBFolderPath), PChar(BBFutureUse) );
finally
FreeLibrary(H);
end;
end;
end
else
begin
ResultsLabel.Caption := 'Result: BackupBurner.dll file not found in the path ';
Application.Restore;
Sleep(5000);
close;
end;
// Now the CD process is complete.
// Unhide or restore your program
Application.Restore;
Button3.Enabled := True;
// OPTIONAL- Inspect the result code
Case ResultCode of
-2: ResultsLabel.Caption := 'Result: ResultCode = -2 Installation Error- version mismatch';
-1: ResultsLabel.Caption := 'Result: ResultCode = -1 User canceled' ;
0: ResultsLabel.Caption := 'Result: ResultCode = 0 it was a successful burn!';
1: ResultsLabel.Caption := 'Result: ResultCode = 1 User canceled';
2: ResultsLabel.Caption := 'Result: ResultCode = 2 Installation Error- files missing';
3: ResultsLabel.Caption := 'Result: ResultCode = 3 Insufficent disk space';
5: ResultsLabel.Caption := 'Result: ResultCode = 5 there was not a blank CD';
7: ResultsLabel.Caption := 'Result: ResultCode = 7 bad burn during writing ';
8: ResultsLabel.Caption := 'Result: ResultCode = 8 no CD recorder detected. ';
9: ResultsLabel.Caption := 'Result: ResultCode = 9 Demo expired. ';
11: ResultsLabel.Caption := 'Result: ResultCode = 11 User does not have admin rights to access the ASPI manager. ';
else
ResultsLabel.Caption := 'Result: There was an unknown result.';
end;
// OPTIONAL- delete unneeded files from \Bin\FilesToBackup\
DeleteFile(Pchar('Bin\FilesToBackup\Example.txt'));
// You are done.
end;
procedure TForm1.TwoButtonClick(Sender: TObject);
begin
if OpenDialog1.Execute then { Display Open dialog box }
begin
CopyFile(Pchar(OpenDialog1.FileName),Pchar(ExtractFilePath(ParamStr(0))+ '\Bin\FilesToBackup\'+ ExtractFileName(OpenDialog1.FileName)),FALSE );
end;
end;
procedure TForm1.ExitClick(Sender: TObject);
begin
Close;
end;
end.